package com.smart.consumer.service.impl;

import com.smart.consumer.common.reqeust.UserRequestParams;
import com.smart.consumer.common.response.ResponseVo;
import com.smart.consumer.common.vo.UserVo;
import com.smart.consumer.feign.UserFeignApi;
import com.smart.consumer.service.TestService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 微服务通过控制层提供数据
 */
@Service
public class TestServiceImpl implements TestService {
    @Resource
    UserFeignApi userFeignApi;

    @Override
    public ResponseVo<String> test() {
        ResponseVo<String> responseVo = userFeignApi.provider();
        return responseVo;
    }

    /**
     * 带参数
     *
     * @return
     */
    @Override
    public ResponseVo<UserVo> list(int page, int size) {
        ResponseVo<UserVo> responseVo = userFeignApi.list(page, size);
        return responseVo;
    }

    /**
     * @param userRequestParams
     * @return
     */
    @Override
    public ResponseVo<UserVo> register(UserRequestParams userRequestParams) {
        ResponseVo<UserVo> responseVo = userFeignApi.register(userRequestParams);
        return responseVo;
    }

    @Override
    public ResponseVo<UserVo> detail(Integer uid) {
        ResponseVo<UserVo> detail = userFeignApi.detail(uid);
        return detail;
    }
}
